import React from "react";
import { useContext } from "react";
//3. 导入 Context 对象
import {Context} from './A';

export default function C() {
  //4. 通过 Context 获取共享的数据
  let {msg, style, count, setCount} = useContext(Context);
  
  return (
    <div>
      <div>C</div>
      <h3 style={style}>{msg}</h3>
      <h3>{count}</h3>
      <button onClick={() => {
        setCount(count + 1);
      }}>增加</button>
    </div>
  );
}
